public class Student {
    private String id;
    private String name;
    private String gender;
    private Course course;

    public Student(String id, String name, String gender) {
        this.id = id;
        this.name = name;
        this.gender = gender;
    }

    public void selectCourse(Course course) {
        this.course = course;
        System.out.println(name + " 选了 " + course.getName() + " 课程");
    }

    public void dropCourse() {
        if (course != null) {
            System.out.println(name + " 退了 " + course.getName() + " 课程");
            course = null;
        } else {
            System.out.println(name + " 没有选课，无法退课");
        }
    }

    public void printCourseSchedule() {
        if (course != null) {
            System.out.println("学生编号：" + id);
            System.out.println("课程名称：" + course.getName());
            System.out.println("上课地点：" + course.getLocation());
            System.out.println("上课时间：" + course.getTime());
            System.out.println("授课教师：" + course.getTeacher().getName());
        } else {
            System.out.println(id + " 暂无选课记录");
        }
    }

    public String getId() { return id; }
    public String getName() { return name; }
}